import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:live_music/components/ui/theme.dart';
import 'package:live_music/models/user_info_model.dart';
import 'package:live_music/pages/other/click_see_other.dart';

class OtherListCardFriend extends StatefulWidget {
  OtherListCardFriend({
    Key key,
    this.index,
    this.userListItem,
  }) : super(key: key);
  final int index;
  final UserInfoModel userListItem;
  @override
  _OtherListCardFriendState createState() => _OtherListCardFriendState();
}

class _OtherListCardFriendState extends State<OtherListCardFriend>
    with SingleTickerProviderStateMixin {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return InkWell(
        child: Container(
          padding: const EdgeInsets.symmetric(horizontal: 12),
          margin: const EdgeInsets.only(top: 24),
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              CircleAvatar(
                radius: 25,
                backgroundImage: NetworkImage(widget.userListItem.avatarUrl),
              ),
              Expanded(
                child: Container(
                  padding: const EdgeInsets.only(bottom: 15),
                  margin: const EdgeInsets.only(left: 24),
                  decoration: BoxDecoration(
                    border: Border(
                      bottom: BorderSide(
                        width: .5,
                        color: WcaoTheme.placeholder.withOpacity(.5),
                      ),
                    ),
                  ),
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text(
                            widget.userListItem.name,
                            style: TextStyle(
                              fontSize: 14,
                              fontWeight: FontWeight.bold,
                            ),
                          )
                        ],
                      ),
                      Container(
                        margin: const EdgeInsets.only(top: 4),
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Expanded(
                              child: Container(
                                padding: const EdgeInsets.only(right: 24),
                                child: Text(
                                  widget.userListItem.description != ""
                                      ? widget.userListItem.description
                                      : "暂无简介",
                                  overflow: TextOverflow.ellipsis,
                                  style: TextStyle(
                                    color: WcaoTheme.secondary,
                                    fontSize: 12,
                                  ),
                                ),
                              ),
                            )
                          ],
                        ),
                      )
                    ],
                  ),
                ),
              )
            ],
          ),
        ),
        onTap: () {
          Get.to(PageViewOther(userId: widget.userListItem.id));
        });
  }
}
